/*----------------------------------------------------------------------
  - File name      : STC8Ax_ADC.h
  - Author         : Quark Team
  - Update date    : 2020-12-09                   
  -	Copyright      : Gevico Electronic studio   
  - Module comments: Header file of ADC module.
-----------------------------------------------------------------------*/
#ifndef __STC8Ax_ADC_H_
#define __STC8Ax_ADC_H_
/*-----------------------------------------------------------------------
|                               INCLUDES                                |
-----------------------------------------------------------------------*/
/*--------------------------------------------------------
| @Description: STC8Ax Options                           |
--------------------------------------------------------*/
#include "STC8Ax_REG.h"   
/*--------------------------------------------------------
| @Description: STC8Ax core                              |
--------------------------------------------------------*/
#include "STC8Ax_CORE.h"
/*-----------------------------------------------------------------------
|                                 DATA                                  |
-----------------------------------------------------------------------*/

/*--------------------------------------------------------
| @Description: ADC road enum                            |
--------------------------------------------------------*/
typedef enum
{
    ADC_Road_P10 = 0x00, 
    ADC_Road_P11 = 0x01, 
    ADC_Road_P12 = 0x02, 
    ADC_Road_P13 = 0x03, 
    ADC_Road_P14 = 0x04, 
    ADC_Road_P15 = 0x05, 
    ADC_Road_P16 = 0x06, 
    ADC_Road_P17 = 0x07, 
		  
    ADC_Road_P00 = 0x08, 
    ADC_Road_P01 = 0x09, 
    ADC_Road_P02 = 0x0A, 
    ADC_Road_P03 = 0x0B, 
    ADC_Road_P04 = 0x0C, 
    ADC_Road_P05 = 0x0D, 
    ADC_Road_P06 = 0x0E, 
    ADC_Road_REV = 0x0F	//Test the internal 1.344v refv voltage
}   ADCRoad_Type;

/*--------------------------------------------------------
| @Description: ADC Accuracy enum                        |
--------------------------------------------------------*/

typedef enum
{
    ADC_Acc_12Bit = 0,    //12 bit accuracy
    ADC_Acc_11Bit    ,    //11 bit accuracy
    ADC_Acc_10Bit    ,    //10 bit accuracy
    ADC_Acc_9Bit     ,    //9 bit accuracy
    ADC_Acc_8Bit          //8 bit accuracy
}   ADCAcc_Type;

/*--------------------------------------------------------
| @Description: ADC Align enum                           |
--------------------------------------------------------*/

typedef enum
{
    ADC_Left  = 0,  //After set, the data is aligned to the left
    ADC_Right = 1,  //After collection, the data is aligned to the right
}   ADCAlign_Type;

/*--------------------------------------------------------
| @Description: ADC init struct                          |
--------------------------------------------------------*/

typedef struct 
{
    FUNSTATE Power;
    ADCRoad_Type Road;
    uint8 Speed;
    ADCAlign_Type Align; 
    FUNSTATE Run;  
}   ADC_InitType;

/*-----------------------------------------------------------------------
|                             API FUNCTION                              |
-----------------------------------------------------------------------*/
/*--------------------------------------------------------
| @Description: ADC get Sample (Query mode)              |
--------------------------------------------------------*/

uint16 ADC_Get_Sample(ADCRoad_Type Road, ADCAcc_Type Acc);

/*--------------------------------------------------------
| @Description: ADC init function                        |
--------------------------------------------------------*/

FSCSTATE ADC_Init(const ADC_InitType *ADCx);

#endif
/*-----------------------------------------------------------------------
|          END OF FLIE        (C) COPYRIGHT Gevico Electronics          | 
-----------------------------------------------------------------------*/

